package com.info33.platform.config.shiro.token;

import com.info33.platform.common.enums.LoginType;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.shiro.authc.UsernamePasswordToken;

/**
 * 自定义token,用于确定登陆者类型
 * <p>Title: UserToken</p>
 * <p>Description: </p>
 *
 * @author Adam
 * @date 2018年8月14日
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class UserToken extends UsernamePasswordToken {

    /**
     * 登录方式
     */
    private LoginType loginType;

    /**
     * 短信验证码
     */
    private Integer code;

    public UserToken(String username, Integer code, LoginType loginType) {
        super(username, "");
        this.loginType = loginType;
        this.code = code;
    }

    public UserToken(String username, Integer code, String host, LoginType loginType) {
        super(username, "", host);
        this.loginType = loginType;
        this.code = code;
    }

    public UserToken(String username, String password, String host, LoginType loginType) {
        super(username, password, host);
        this.loginType = loginType;
    }

    public UserToken(String username, String password, LoginType loginType) {
        super(username, password);
        this.loginType = loginType;
    }

}